package com.hdax.dm.rest.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hdax.dm.dao.scheduler.DmSchedulerMapper;
import com.hdax.dm.entity.scheduler.DmScheduler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(path = "/rest/scheduler")
@Api(value = "排期信息接口",tags = "排期信息接口")
public class DmSchedulerRestService {

    @Resource
    private DmSchedulerMapper dmSchedulerMapper;

    @PostMapping(path = "/byItem")
    @ApiOperation(value = "查询排期集合（根据商品id）")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "itemId", required = true, type = "long")
    })
    public List<DmScheduler> getSchedulersByItem(@RequestParam("itemId")Long itemId){
        QueryWrapper<DmScheduler> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("itemId",itemId);
        return dmSchedulerMapper.selectList(queryWrapper);
    }


}
